import numpy as np

if __name__ == '__main__':
    lst = [1, 2, 3]
    lst[0] = "hanhan"
    print(lst)

    vec = np.array([1, 2, 3])
    vec2 = np.array([4, 5, 6])
    print(vec)

    print(np.zeros(5))
    print(np.ones(5))
    print(np.full(5, 10))

    print("size =", vec.size)
    print("size =", len(vec))
    print(vec[0: 2])
    print(vec[:2])

    print("{} + {} = {}".format(vec, vec2, vec + vec2))
    print("{} * {} = {}".format(vec, 2, vec * 2))
    print("{} * {} = {}".format(2, vec, 2 * vec))
    print("{}.dot({}) = {}".format(vec, vec2, vec.dot(vec2)))

    print("==============")
    # 模
    print(np.linalg.norm(vec))
    # 归一化  单位向量
    print( vec / np.linalg.norm(vec))
    # 单位向量的模 should be 1
    print(np.linalg.norm(vec / np.linalg.norm(vec)))



